<script>
  export default {
    name: 'subComp',
    props: {
      type: {
        type: String,
        default: ''
      },
      info: {
        type: String,
        default: ''
      }
    },
    render (h, context) {
      let component
      switch (context.props.type) {
        case 'subA':
          component = require('./sub-a')
          break
        case 'subB':
          component = require('./sub-b')
          break
      }
      // 渲染函数初始化组件
      return h(component, { props: context.props })
    },
    // 必填项
    functional: true
  }
</script>
